package com.jt.resource.controller;

import com.jt.resource.annotation.RequiredLog;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/resource")
public class ResourceController {

    @RequiredLog("查询资源")
    @PreAuthorize("hasAuthority('sys:res:list')")
    @GetMapping
    public String doSelect(){
        return "select resource ok!";
    }

    @PreAuthorize("hasAuthority('sys:res:create')")
    @PostMapping
    public String doCreate(){
        return "create resource ok";
    }

    @PreAuthorize("hasAuthority('sys:res:update')")
    @PutMapping
    public String doUpdate(){
        return "update resource ok";
    }

    @PreAuthorize("hasAuthority('sys:res:delete')")
    @DeleteMapping
    public String doDelete(){
        return "delete resource ok";
    }

    @GetMapping("/export")
    public String doExport(){
        return "export resource ok";
    }
}
